﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace craigsPack
{
    public class CraigsListSearchSettings : WebProviderSearchSettings
    {
        private int maxPrice = 0;
        private int minPrice = 0;
        private int bedrooms = 0;

        private bool allowCats = false;
        private bool allowDogs = false;
        private bool isTele = false;
        private bool isContract = false;
        private bool isPartTime = false;
        private bool isIntern = false;
        private bool isNonProfit = false;
        private bool isPay = false;



        public CraigsListSearchSettings()
            :base()
        {
            Cities = new CityIdCollection();
            Keywords = new KeywordCollection();
            this["minPrice"] = "0";
            this["maxPrice"] = "0";
        }
        public WeakDate LatestDate { get; set; }
        public bool SearchEntirePost { get; set; }

        public bool HasPics { get; set; }

        public int MaxPrice
        {
            get 
            {
                if (Category != CraigsListCategory.Sale)
                    throw new NotSupportedException();

                return maxPrice; 
            }
            set
            {
                if (Category != CraigsListCategory.Sale)
                    throw new NotSupportedException();

                maxPrice = value;
            }
        }
        public int MinPrice
        {
            get
            {
                if (Category != CraigsListCategory.Sale)
                    throw new NotSupportedException();

                return minPrice;
            }
            set
            {
                if (Category != CraigsListCategory.Sale)
                    throw new NotSupportedException();

                minPrice = value;
            }
        }
        public int Bedrooms
        {
            get
            {
                if (Category != CraigsListCategory.Housing)
                    throw new NotSupportedException();

                return bedrooms;
            }
            set
            {
                if (Category != CraigsListCategory.Housing)
                    throw new NotSupportedException();

                bedrooms = value;
            }
        }
        public bool AllowCats
        {
            get
            {
                if (Category != CraigsListCategory.Housing)
                    throw new NotSupportedException();

                return allowCats;
            }
            set
            {
                if (Category != CraigsListCategory.Housing)
                    throw new NotSupportedException();

                allowCats = value;
            }
        }
        public bool AllowDogs
        {
            get
            {
                if (Category != CraigsListCategory.Housing)
                    throw new NotSupportedException();

                return allowDogs;
            }
            set
            {
                if (Category != CraigsListCategory.Housing)
                    throw new NotSupportedException();

                allowDogs = value;
            }
        }
        public bool IsTeleCommuting
        {
            get
            {
                if (Category != CraigsListCategory.Jobs)
                    throw new NotSupportedException();

                return isTele;
            }
            set
            {
                if (Category != CraigsListCategory.Jobs)
                    throw new NotSupportedException();

                isTele = value;
            }
        }
        public bool IsContract
        {
            get
            {
                if (Category != CraigsListCategory.Jobs)
                    throw new NotSupportedException();

                return isContract;
            }
            set
            {
                if (Category != CraigsListCategory.Jobs)
                    throw new NotSupportedException();

                isContract = value;
            }
        }
        public bool IsPartTime
        {
            get
            {
                if (Category != CraigsListCategory.Jobs)
                    throw new NotSupportedException();

                return isPartTime;
            }
            set
            {
                if (Category != CraigsListCategory.Jobs)
                    throw new NotSupportedException();

                isPartTime = value;
            }
        }
        public bool IsInternship
        {
            get
            {
                if (Category != CraigsListCategory.Jobs)
                    throw new NotSupportedException();

                return isIntern;
            }
            set
            {
                if (Category != CraigsListCategory.Jobs)
                    throw new NotSupportedException();

                isIntern = value;
            }
        }
        public bool IsNonProfit
        {
            get
            {
                if (Category != CraigsListCategory.Jobs)
                    throw new NotSupportedException();

                return isNonProfit;
            }
            set
            {
                if (Category != CraigsListCategory.Jobs)
                    throw new NotSupportedException();

                isNonProfit = value;
            }
        }
        public bool IsPay
        {
            get
            {
                if (Category != CraigsListCategory.Gigs)
                    throw new NotSupportedException();

                return isPay;
            }
            set
            {
                if (Category != CraigsListCategory.Gigs)
                    throw new NotSupportedException();

                isPay = value;
            }
        }
        public CraigsListCategory Category { get; set; }

        public KeywordCollection Keywords { get; set; }
        public CityIdCollection Cities { get; set; }
    }
}
